<template>
  <ul>
    <li>
      <b>今天也是美好的一天</b>
      &nbsp;
      <button type="mini"
        @click="delComment(item.id)">删除</button>
    </li>
  </ul>
</template>

<script>
import * as api from "@/api/comment";
import { mapActions, mapState } from "vuex";
export default {
  methods: {
    ...mapActions("comment", ["FETCH_COMMENT"]),
    async delComment() {
      let res = await api.delComment(id);
      if (res.data.state) {
        this.FETCH_COMMENT();
      }
    },
  },
  computed: {
    ...mapState("comment", ["comments"]),
  },
  created() {
    this.FETCH_COMMENT();
  },
};
</script>